package com.sskj.mine.ui.activity;


import android.os.Bundle;
import android.widget.TextView;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.alibaba.android.arouter.launcher.ARouter;
import com.allen.library.SuperTextView;
import com.sskj.common.base.App;
import com.sskj.common.util.ClickUtil;
import com.sskj.lib.RConfig;
import com.sskj.lib.base.BaseActivity;
import com.sskj.mine.R;
import com.sskj.mine.R2;
import com.sskj.mine.bean.SpreadTitleBean;
import com.sskj.mine.presenter.SpreadMenuActivityPresenter;

import butterknife.BindView;
import butterknife.ButterKnife;

@Route(path = RConfig.MINE_SPREAD_MENU)//我的推广
public class SpreadMenuActivity extends BaseActivity<SpreadMenuActivityPresenter> {
    @BindView(R2.id.tvFriend)
    TextView tvFriend;
    @BindView(R2.id.tvMoney)
    TextView tvMoney;
    @BindView(R2.id.stvFriend)
    SuperTextView stvFriend;
    @BindView(R2.id.stvDetail)
    SuperTextView stvDetail;
    @BindView(R2.id.stvSpread)
    SuperTextView stvSpread;

    @Override
    protected int getLayoutId() {
        return R.layout.mine_activity_spread_menu;
    }

    @Override
    public SpreadMenuActivityPresenter getPresenter() {
        return new SpreadMenuActivityPresenter();
    }

    @Override
    protected void initView() {
        setTitle(App.INSTANCE.getString(R.string.mine_spreadMenuActivity1_j));
        ClickUtil.click(stvFriend, () -> {
            ARouter.getInstance().build(RConfig.MINE_FRIEND).navigation();
        });
        ClickUtil.click(stvDetail, () -> {
            ARouter.getInstance().build(RConfig.MINE_DETAIL_LIST).navigation();
        });
        ClickUtil.click(stvSpread, () -> {
            ARouter.getInstance().build(RConfig.MINE_SPREAD).navigation();
        });
    }

    @Override
    protected void initData() {
        mPresenter.getData();
    }

    public void updateUI(SpreadTitleBean data) {
        tvFriend.setText(data.getTtl());
        tvMoney.setText(data.getTotal_sum());
    }
}
